﻿@model AutoLot.Models.Entities.Car
@{
    ViewData["Title"] = "RazorSyntax";
}

<h1>Razor Syntax</h1>

@for (int i = 0; i < 15; i++)
{
    //do something
}

@{
    //Code Block
    var foo = "Foo";
    var bar = "Bar";
    var htmlString = "<ul><li>one</li><li>two</li></ul>";
}

@foo<br />
@htmlString<br />
@foo.@bar<br />

@foo.ToUpper()<br/>

@Html.Raw(htmlString)<br/>
<hr />

@{
    @:Straight Text
    <div>Value:@Model.Id</div>
    <text>
        Lines without HTML tag
    </text>
    <br />
}
<hr/>

Email Address Handling:<br/>
foo@foo.com<br />
@@foo<br />
test@foo<br/>
test@(foo)<br />

@*
    Multiline Comments
    Hi.
*@

@functions {
    public static IList<string> SortList(IList<string> strings)  {
        var list = from s in strings orderby s select s;
        return list.ToList();
    }
}

@{
    var myList = new List<string> {"C", "A", "Z", "F"};
    var sortedList = SortList(myList); 
}
@foreach (string s in sortedList)
{
    @s@:&nbsp;
}
<hr/>

@{
    Func<dynamic, object> b = @<strong>@item</strong>;
}
This will be bold: @b("Foo")
<hr/>
The Car named @Model.PetName is a <span style="color:@Model.Color">@Model.Color</span> @Model.MakeNavigation.Name
<hr/>
Display For examples
Make:
@Html.DisplayFor(x=>x.MakeNavigation)
Car:
@Html.DisplayForModel()
@Html.DisplayForModel("../Cars/DisplayTemplates/Car.cshtml")

@Html.EditorForModel()
@Html.EditorForModel("../Cars/EditorTemplates/Car.cshtml")
<hr/>
<a asp-controller="Cars" asp-action="Details" asp-route-id="@Model.Id">@Model.PetName</a>
